home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / envoyempire / source / icegui.c < prev   
C/C++ Source or Header  |  1995-07-10  |  20KB  |  666 lines

  1. #include "defines.h"
  2. #include "guidefines.h"
  3. #include "struct.h"
  4. #include "stdarg.h"
  5. #include "externalprototypes.h"
  6.  
  7. /* this code is how the server communicates with the GUI */
  8. int  changeplayer(void);
  9. extern int planetnumber;
  10. extern LONG GALAXY;
  11. extern struct MsgPort *client;
  12. extern struct planet **planetlist;
  13. extern struct sector   **SECTOR;
  14. extern struct player *currentplayer;
  15. extern ULONG signals;
  16. extern struct MsgPort *in,*out,*dataport;
  17. extern short chan;
  18.  
  19. extern BOOL insector(int,int,int);
  20. BOOL   SafePutMsg(struct Message *message, STRPTR portname);
  21. ULONG  guiinput(void);
  22. int    guiset(struct MsgPort *,LONG datasize,LONG object,LONG method,LONG data); 
  23. int    guiget(struct MsgPort *,LONG datasize,LONG object,LONG method,APTR data); 
  24. int    guiDoMethod(struct MsgPort *, LONG,LONG,LONG object,ULONG data,...);
  25. int    senddata (struct MsgPort *in, struct MsgPort *out,int length, short datatype,LONG *data);
  26. LONG   guiRequest(LONG id); 
  27. void   *getdata(LONG datatype);
  28. int    imagesetup (void);
  29. int    mapsetup(struct MsgPort *);
  30. int    empiresetup (struct MsgPort *client);
  31.  
  32.  
  33. ULONG guiinput ()
  34. {
  35.   return(0); /* dummy fuction */
  36.  
  37. }
  38.  
  39. int imagesetup ()
  40. {
  41.   return(0); /* dummy function */
  42. }
  43.  
  44.  
  45. LONG guiRequest(LONG id) {
  46.   
  47.   LONG *tempdata; 
  48.   LONG length = sizeof(LONG)*4;  
  49.   tempdata = AllocVec(length,MEMF_CLEAR);
  50.         
  51.   /* send data for sending */              
  52.   
  53.   /* 
  54.    * put up a requestor on a client's machine 
  55.    */
  56.   
  57.   if (!out) return(0);
  58.   if (tempdata) {
  59.     tempdata[0]  = GUI_REQUEST; /* message type */
  60.     tempdata[1]  = sizeof(LONG);/* data length  */
  61.     tempdata[2]  = 0;           /* no object    */
  62.     tempdata[3]  = id;          /* actual data  */
  63.     senddata(in,out,length,CSDATA,tempdata);
  64.     /* release memory */
  65.     FreeVec(tempdata);
  66.   }
  67.  
  68.   return(0);
  69. }
  70.  
  71.  
  72. int senddata (struct MsgPort *in, struct MsgPort *out,int length, short datatype, LONG *data) {
  73.   
  74.   struct MuxMsg *mmsg;
  75.   
  76.   /*
  77.    * send data to the IceBBS for sending to the client
  78.    */
  79.   
  80.   if (!out) return(0); /* make sure port is available */
  81.   if (mmsg = (struct MuxMsg *) AllocMem(SIZE(MuxMsg), MEMF_CLEAR)) {
  82.      mmsg->Length = length;
  83.      if (mmsg->Data = (UBYTE *) AllocMem(length, MEMF_CLEAR))
  84.        {
  85.        memcpy(&mmsg->Data[0],data,length);
  86.        mmsg->Type = datatype;
  87.        mmsg->priority = 0;
  88.        mmsg->msg.mn_ReplyPort = in;
  89.        PutMsg(out, (struct Message *) mmsg);  /** send message **/
  90.        }
  91.      else {
  92.         FreeMem(mmsg,SIZE(MuxMsg));
  93.         return(1);
  94.      }
  95.   }
  96.   if (length >240) printf("sending %d bytes\n",length); 
  97.   return(0);
  98. }
  99.  
  100.  
  101. int guiset(struct MsgPort *client,LONG datasize,LONG object,LONG method,LONG data) {
  102.  
  103.   
  104.   LONG *tempdata; 
  105.   LONG length =0;
  106.   struct player *player;
  107.   
  108.   /* 
  109.    * do a setAttrs on a client's machine 
  110.    */
  111.   
  112.   out = client;
  113.   if (!out) return(0);
  114.   
  115.   /* 
  116.    * need to know datasize
  117.    */
  118.    
  119.   switch (datasize) {
  120.      case INT:
  121.        length = sizeof(LONG);
  122.        break;
  123.      case SMALLSTRING:
  124.        length = sizeof(char[30]);
  125.        break;
  126.      case LARGESTRING:
  127.        length = sizeof(char[100]);
  128.        break;
  129.      case CARGO:
  130.        length = sizeof(struct tagchar);
  131.        break;
  132.      case FLEET:
  133.        length = sizeof(struct force);
  134.        break;
  135.      case ITEM:
  136.        length = sizeof(struct item);
  137.        break;
  138.      case SHIPTAG:
  139.        length = sizeof(struct shiptag);
  140.        break;  
  141.      case SHIP:
  142.        length = sizeof(struct ship);
  143.        break;  
  144.   }
  145.  
  146.   tempdata = AllocVec(sizeof(LONG)*4+length,MEMF_CLEAR);
  147.   /*
  148.   printf("sending a guiset\n");   
  149.   */
  150.   /* send data for sending */              
  151.   if (tempdata) {
  152.     tempdata[0] = GUI_SETUPDATE;
  153.     tempdata[1] = length;   /* data length */
  154.     tempdata[2] = object;
  155.     tempdata[3] = method;
  156.     if (datasize == INT) tempdata[4] = data;
  157.     else if (data) memcpy(&tempdata[4],data,length);
  158.       else {
  159.         tempdata[4] = NULL;
  160.         tempdata[1] = sizeof(LONG);
  161.         }
  162.     if (out) senddata(in,out,4*sizeof(LONG)+length,CSDATA,tempdata);
  163.     else {
  164.         player = headplayer;
  165.         while(player) {
  166.            if (player->messageport) senddata(in,player->messageport,4*sizeof(LONG)+length,CSDATA,tempdata);
  167.            player = player->next;
  168.         }
  169.     }
  170.     
  171.     /* release memory */
  172.     FreeVec(tempdata);
  173.   }
  174.   
  175.   return(0);
  176. }  
  177.  
  178. void *getdata(LONG datatype) {
  179.   
  180.   static int  number;
  181.   static char smallstring[30];
  182.   static char largestring[100];
  183.   static struct tagchar cargotag;
  184.   static struct force fleet;
  185.   static struct temp displayfleet;
  186.   static struct item item;
  187.   static struct shiptag shiptag;
  188.   static struct ship ship;
  189.   struct player *player;
  190.   LONG messagetype; 
  191.   void *pointer1,*pointer2;
  192.   struct MuxMsg *mmsg;
  193.   BOOL quit=FALSE;
  194.   LONG *message;
  195.   ULONG mysig=NULL,portflag=NULL;
  196.   
  197.   /* 
  198.    * wait for retrieved data, I need to put in a time to abort a request
  199.    */
  200.   
  201.   portflag = 1L << dataport->mp_SigBit;
  202.   
  203.   while (!quit) {
  204.     if (!out) return (NULL);
  205.     mysig = Wait(portflag | SIGBREAKF_CTRL_C); /* wait for requested info */  
  206.   
  207.     if (mysig & portflag) { 
  208.       while (mmsg = (struct MuxMsg *) GetMsg(dataport))
  209.         {
  210.            if (mmsg->msg.mn_ReplyPort == in)
  211.            {
  212.            if (mmsg->Data && mmsg->Length && (mmsg->Type == CSDATA)) 
  213.              
  214.              FreeMem(mmsg->Data, mmsg->Length);
  215.              FreeMem(mmsg, SIZE(MuxMsg));
  216.            }
  217.            else if (mmsg->Type == CSDATA) {
  218.                message = (LONG *)mmsg->Data;
  219.                messagetype = message[0];
  220.                pointer1 = &message[1];
  221.                pointer2 = NULL;
  222.                /*
  223.                printf("received messagetype %d\n",messagetype);
  224.                */
  225.                if (messagetype == GUI_NULL) return (NULL);
  226.                
  227.                switch (datatype) {
  228.                  case INT:
  229.                     memcpy(&number,pointer1,sizeof(number));
  230.                     pointer2 = (void *)number;
  231.                     break;
  232.                  case SMALLSTRING:
  233.                     memcpy(smallstring,pointer1,sizeof(smallstring));
  234.                     pointer2 = smallstring;
  235.                     break;
  236.                  case LARGESTRING:
  237.                     memcpy(largestring,pointer1,sizeof(largestring));
  238.                     pointer2 = largestring;
  239.                     break;
  240.                  case CARGO:
  241.                     memcpy(&cargotag,pointer1,sizeof(cargotag));
  242.                     pointer2 = &cargotag;
  243.                     break;
  244.                  case FLEET:
  245.                     memcpy(&fleet,pointer1,sizeof(fleet));
  246.                     pointer2 = &fleet;
  247.                     break;
  248.                  case TEMPFLEET:
  249.                     memcpy(&displayfleet,pointer1,sizeof(displayfleet));
  250.                     pointer2 = &displayfleet;
  251.                     break;
  252.                  case ITEM:
  253.                     memcpy(&item,pointer1,sizeof(item));
  254.                     pointer2 = &item;
  255.                     break;
  256.                  case SHIPTAG:
  257.                     memcpy(&shiptag,pointer1,sizeof(shiptag));
  258.                     pointer2 = &shiptag;
  259.                     break;
  260.                  case SHIP:
  261.        
  262.                     memcpy(&ship,pointer1,sizeof(ship));
  263.                     pointer2 = &ship;
  264.                     break;  
  265.                  default:
  266.                     break;
  267.                  }
  268.               ReplyMsg((struct Message *) mmsg);
  269.               return(pointer2);
  270.            }
  271.            else if (mmsg->Type == SCKILL)
  272.            {
  273.              player = headplayer;
  274.                while (player) {
  275.                   if (player->messageport == mmsg->msg.mn_ReplyPort) {
  276.                      player->messageport = NULL;
  277.                      printf("player %s has disconnected\n",player->name);
  278.                      break;
  279.                   }
  280.                   player = player->next;
  281.                }
  282.              ReplyMsg((struct Message *) mmsg);
  283.              Delay(30L);
  284.              return (NULL);
  285.            }
  286.            else if (mmsg->Type == DIENOW)
  287.            {
  288.              player = headplayer;
  289.                while (player) {
  290.                   if (player->messageport == mmsg->msg.mn_ReplyPort) {
  291.                      player->messageport = NULL;
  292.                      printf("player %s has unexpectedly disconnected\n",player->name);
  293.                      break;
  294.                   }
  295.                   player = player->next;
  296.                }
  297.              ReplyMsg((struct Message *) mmsg);
  298.              Delay(30L);
  299.              return (NULL);
  300.            }
  301.          }
  302.       }
  303.       if (mysig & SIGBREAKF_CTRL_C) return (NULL);
  304.   }     
  305.   
  306.   return(NULL);
  307. }
  308.  
  309. int guiget(struct MsgPort *client,LONG datasize,LONG object,LONG method,APTR data) {
  310.  
  311.  
  312. APTR *temp;
  313. LONG *tempdata;
  314. LONG length =0;
  315.   
  316.   out = client;
  317.   if (!out) return(0);
  318.   switch (datasize) {
  319.      case INT:
  320.        length = sizeof(LONG);
  321.        break;
  322.      case SMALLSTRING:
  323.        length = sizeof(char[30]);
  324.        break;
  325.      case LARGESTRING:
  326.        length = sizeof(char[100]);
  327.        break;
  328.      case CARGO:
  329.        length = sizeof(struct tagchar);
  330.        break;
  331.      case FLEET:
  332.        length = sizeof(struct force);
  333.        break;
  334.      case ITEM:
  335.        length = sizeof(struct item);
  336.        break;
  337.      case SHIPTAG:
  338.        length = sizeof(struct shiptag);
  339.        break;
  340.      case SHIP:
  341.        length = sizeof(struct ship);
  342.        break;
  343.        
  344.   }
  345.  
  346.   tempdata = AllocVec(sizeof(LONG)*5,MEMF_CLEAR);
  347.   /* send data for sending */              
  348.   if (tempdata) {
  349.     tempdata[0] = GUI_GET;
  350.     tempdata[1] = length;
  351.     tempdata[2] = object;
  352.     tempdata[3] = method;
  353.     tempdata[4] = (LONG)data;
  354.     senddata(in,out,5*sizeof(LONG),CSDATA,tempdata);
  355.     temp = (APTR *)(data);
  356.     FreeVec(tempdata);
  357.     *temp = getdata(datasize);
  358.     }
  359.              
  360. /*
  361.   if (data = getdata(CHAR));
  362. */
  363.   return (0);
  364.  
  365. int guiDoMethod(struct MsgPort *client, LONG message, LONG datatype,LONG object,ULONG data,...) {
  366.  
  367. LONG length=0;
  368. LONG *tempdata;
  369. va_list argptr;
  370. APTR *temp;
  371.  
  372.   
  373.   va_start(argptr,data); /* intialize var args */
  374.   out = client; 
  375.   if (!out) return(0);
  376.   switch (datatype) {
  377.      case INT:
  378.        length = sizeof(LONG);
  379.        break;
  380.      case SMALLSTRING:
  381.        length = sizeof(char[30]);
  382.        break;
  383.      case LARGESTRING:
  384.        length = sizeof(char[100]);
  385.        break;
  386.      case CARGO:
  387.        length = sizeof(struct tagchar);
  388.        break;
  389.      case FLEET:
  390.        length = sizeof(struct force);
  391.        break;
  392.      case TEMPFLEET:
  393.        length = sizeof(struct temp);
  394.        break;
  395.      case ITEM:
  396.        length = sizeof(struct item);
  397.        break;
  398.      case SHIPTAG:
  399.        length = sizeof(struct shiptag);
  400.        break;
  401.      case SHIP:
  402.        length = sizeof(struct ship);
  403.        break;  
  404.      default:
  405.        length = 0;
  406.        break;
  407.   }
  408.   
  409.   switch (message) {
  410.      case GUI_DOMETHODGET3:
  411.      /* if data length is 0, just pass message, if data = 1, then
  412.         we expect data back */
  413.         /* make memory for transfer of stack data */
  414.         tempdata = AllocVec(sizeof(LONG)*5,MEMF_CLEAR);
  415.         
  416.         /* send data for sending */              
  417.         if (tempdata) {
  418.           tempdata[0] = GUI_DOMETHODGET3;
  419.           tempdata[1] = length;
  420.           tempdata[2] = object;
  421.           tempdata[3] = data;
  422.           tempdata[4] = va_arg(argptr,LONG);
  423.           senddata(in,out,5*sizeof(LONG),CSDATA,tempdata);
  424.           temp = (APTR *)tempdata[4];
  425.           FreeVec(tempdata);
  426.           if (length) {
  427.             *temp = getdata(datatype);
  428.             }
  429.           }
  430.         break;
  431.         
  432.      case GUI_DOMETHODGET4:
  433.         /* need info and message reply is needed */
  434.         /* make memory for transfer of stack data */
  435.         tempdata = AllocVec(sizeof(LONG)*6,MEMF_CLEAR);
  436.         /* send data for sending */              
  437.         if (tempdata) {
  438.           tempdata[0] = GUI_DOMETHODGET4;
  439.           tempdata[1] = length;
  440.           tempdata[2] = object;
  441.           tempdata[3] = data;
  442.           tempdata[4] = va_arg(argptr,LONG);
  443.           tempdata[5] = va_arg(argptr,LONG);
  444.           senddata(in,out,6*sizeof(LONG),CSDATA,tempdata);
  445.           temp = (APTR *)tempdata[5];
  446.           *temp = getdata(datatype);
  447.           if (!*temp) temp = NULL; 
  448.           FreeVec(tempdata);
  449.         }
  450.         break;
  451.      
  452.      case GUI_DOMETHODGET5:
  453.         /* inserting data, no return is needed */
  454.         tempdata = AllocVec(sizeof(LONG)*7+length,MEMF_CLEAR);
  455.         /* send data for sending */              
  456.         if (tempdata) {
  457.           tempdata[0] = GUI_DOMETHODGET5;
  458.           tempdata[1] = length;
  459.           tempdata[2] = object;
  460.           tempdata[3] = data;
  461.           tempdata[4] = va_arg(argptr,LONG);
  462.           tempdata[5] = va_arg(argptr,LONG);
  463.           tempdata[6] = va_arg(argptr,LONG);
  464.           if (datatype != INT) memcpy(&tempdata[7],*(LONG *)tempdata[4],length);
  465.           else memcpy(&tempdata[7],&tempdata[4],length);
  466.           senddata(in,out,7*sizeof(LONG)+length,CSDATA,tempdata);
  467.           FreeVec(tempdata);
  468.         }
  469.         break;
  470.  
  471.   }
  472.   va_end(argptr); /* end macro */
  473.   return (0);
  474.   
  475. }
  476.  
  477. int empiresetup (struct MsgPort *client) {
  478.  
  479.   struct Empires newempire;
  480.   struct player *player;
  481.   struct computerplayer *computerplayer;
  482.   LONG *data;
  483.   LONG message[3];
  484.   
  485.   message[0] = GUI_EMPIRECLEAR;
  486.   senddata(in,client,3*sizeof(LONG),CSDATA,&message[0]);    
  487.   
  488.   player = headplayer;
  489.   while (player) {
  490.      strcpy(newempire.name,player->empire);
  491.      newempire.id = player->id;
  492.      
  493.      data = AllocVec(sizeof(struct Sector)+sizeof(LONG),MEMF_CLEAR|MEMF_ANY);
  494.      if (data) {
  495.         data[0] = GUI_EMPIRE;
  496.         memcpy(&data[1],&newempire,sizeof(struct Empires));      
  497.         senddata(in,client,sizeof(struct Empires)+sizeof(LONG),CSDATA,data);
  498.         FreeVec(data); 
  499.      }
  500.      player = player->next;
  501.   }
  502.   
  503.   computerplayer = headcomputerplayer;
  504.   while (computerplayer) {
  505.      strcpy(newempire.name,computerplayer->empire);
  506.      newempire.id = computerplayer->id;
  507.      
  508.      data = AllocVec(sizeof(struct Sector)+sizeof(LONG),MEMF_CLEAR|MEMF_ANY);
  509.      if (data) {
  510.         data[0] = GUI_EMPIRE;
  511.         memcpy(&data[1],&newempire,sizeof(struct Empires));      
  512.         senddata(in,client,sizeof(struct Empires)+sizeof(LONG),CSDATA,data);
  513.         FreeVec(data); 
  514.      }
  515.      computerplayer = computerplayer->next;
  516.   }
  517.     
  518.   return(0);
  519. }
  520.  
  521. int mapsetup (struct MsgPort *client) {
  522.  
  523.       int n,m;
  524.       BOOL enemy=FALSE,friendly=FALSE,send = FALSE;
  525.       struct force *fleet;
  526.       struct TagItem *tag;
  527.       struct Sector newsector;
  528.       LONG *data;
  529.       LONG message[3];
  530.       
  531.       message[0] = GUI_MAPCLEAR;
  532.       senddata(in,client,3*sizeof(LONG),CSDATA,&message[0]);    
  533.       
  534.       if (!currentplayer) return(0);
  535.         for (n=0;n<GALAXY;n++) {
  536.           for (m=0;m<GALAXY;m++) {
  537.             send                    = FALSE;
  538.             newsector.planet        = FALSE;
  539.             
  540.             if (SECTOR[n][m].PLANET) {
  541.                send = TRUE;
  542.                newsector.x             = n;
  543.                newsector.y             = m;
  544.                newsector.friendlyfleet = FALSE;
  545.                newsector.enemyfleet    = FALSE;
  546.                newsector.planet        = TRUE;
  547.                newsector.item          = FALSE;
  548.                newsector.text          = planetlist[currentplayer->id][SECTOR[n][m].PLANET->ID].textattribute;      
  549.                if (currentplayer->id == planetlist[0][SECTOR[n][m].PLANET->ID].id) newsector.planetowner = FRIENDLYPLANET;
  550.                else if (planetlist[currentplayer->id][SECTOR[n][m].PLANET->ID].id == 0) newsector.planetowner = NEUTRALPLANET;
  551.                else newsector.planetowner = ENEMYPLANET;
  552.                memcpy(&newsector.planetname,&planetlist[currentplayer->id][SECTOR[n][m].PLANET->ID].name,sizeof(char [30]));      
  553.             }
  554.           
  555.             if (insector(currentplayer->id,n,m)) {
  556.               send        = TRUE;
  557.               newsector.x = n;
  558.               newsector.y = m;
  559.  
  560.               tag = SECTOR[n][m].TAGITEM;
  561.               if (NextTagItem(&tag)) newsector.item = TRUE;
  562.               else  newsector.item = FALSE;  
  563.             
  564.               fleet = SECTOR[n][m].FLEET;
  565.               friendly = enemy = FALSE;
  566.               while (fleet) {
  567.                 if (fleet->id == currentplayer->id) friendly = TRUE;
  568.                 else enemy = TRUE;
  569.                 fleet = fleet->sectornext;
  570.               }
  571.               if (friendly) newsector.friendlyfleet = TRUE;
  572.                 else newsector.friendlyfleet = FALSE;
  573.               if (enemy)    newsector.enemyfleet = TRUE;
  574.                 else  newsector.enemyfleet = FALSE; 
  575.           }
  576.           if (send) {
  577.            data = AllocVec(sizeof(struct Sector)+sizeof(LONG),MEMF_CLEAR|MEMF_ANY);
  578.            if (data)
  579.              data[0] = GUI_MAP;
  580.              memcpy(&data[1],&newsector,sizeof(struct Sector));      
  581.              senddata(in,client,sizeof(struct Sector)+sizeof(LONG),CSDATA,data);
  582.              FreeVec(data); 
  583.            }
  584.         }
  585.       }
  586.   
  587.   return(0);
  588. }
  589.  
  590. int changeplayer() {
  591.   
  592.   int x,n,m;
  593.   char *p;
  594.   struct TagItem *tag,*tstate;
  595.   struct ship *tempship;
  596.   struct player *player;
  597.   struct tagchar *cargo = NULL,cargotag;
  598.   
  599.   if (!currentplayer) return(0);
  600.   out = currentplayer->messageport;
  601.     
  602.   if ((playernumber > 1) && (client == 0)) {
  603.     guiset(out,INT,WI_MOVEMENT,MUIA_Window_Open,FALSE);
  604.     guiset(out,INT,WI_FLEETCARGO,MUIA_Window_Open,FALSE);
  605.   }
  606.   currentplayer->currentfleet = currentfleet = currentplayer->nextfleet;
  607.   guiDoMethod(out,GUI_DOMETHODGET3,0,LV3,MUIM_List_Clear,TRUE);
  608.  
  609.   for (x=0;x<planetnumber;x++) {
  610.     n=planetlist[currentplayer->id][x].x;
  611.     m=planetlist[currentplayer->id][x].y;
  612.     p = planetlist[currentplayer->id][x].name;
  613.     SECTOR[n][m].PLANET=&planetlist[currentplayer->id][x];
  614.     guiDoMethod(out,GUI_DOMETHODGET5,SMALLSTRING,LV3,MUIM_List_Insert,&p,1,MUIV_List_Insert_Bottom);
  615.   }
  616.   x = findplanet(-1,1);
  617.   currentplayer->planet = x;
  618.   displayplanet(x);
  619.   selectplanets();
  620.   if (x>=0) guiset(out,INT,BT_PURCHASE,MUIA_Disabled,FALSE);
  621.   else guiset(out,INT,BT_PURCHASE,MUIA_Disabled,TRUE);
  622.   
  623.   purchase(x);
  624.   currentplayer->currentplanet = &planetlist[currentplayer->id][x];
  625.   selectplanets();
  626.   empiresetup(out);
  627.   mapsetup(out);
  628.   display(currentplayer);
  629.   fleetlist(currentplayer->nextfleet);
  630.   displayfleet(currentplayer->nextfleet);
  631.   displaymessages(currentplayer);
  632.   /* insert ship information */
  633.   tstate = currentplayer->fleettag;
  634.   guiDoMethod(out,GUI_DOMETHODGET3,0,LV11,MUIM_List_Clear,TRUE); 
  635.   while (tag = NextTagItem (&tstate)) {
  636.     tempship = (struct ship *) tag->ti_Data;
  637.     guiDoMethod(out,GUI_DOMETHODGET5,SHIP,LV11,MUIM_List_Insert,&tempship,1,MUIV_List_Insert_Top);
  638.     } 
  639.   
  640.   guiset(out,INT,LV18,MUIA_List_Quiet,TRUE);
  641.   guiDoMethod(out,GUI_DOMETHODGET3,0,LV18,MUIM_List_Clear,TRUE);
  642.   player = headplayer;
  643.   while (player) {
  644.      if (currentplayer->id != player->id) {
  645.        strcpy(cargotag.name,player->empire);
  646.        cargotag.tagdata = player->id;
  647.        cargotag.tagname = (ULONG) player;
  648.        cargo = &cargotag;
  649.        guiDoMethod(out,GUI_DOMETHODGET5,CARGO,LV18,MUIM_List_Insert,&cargo,1,MUIV_List_Insert_Bottom);
  650.      }
  651.      player = player->next;  
  652.   }
  653.   guiset(out,INT,LV18,MUIA_List_Quiet,FALSE);
  654.   if(!currentfleet) guiset(out,INT,BT_MOVEMENT,MUIA_Disabled,TRUE);
  655.   else guiset(out,INT,BT_MOVEMENT,MUIA_Disabled,FALSE);
  656.   
  657.   setdisplay();
  658.   guiset(out,INT,WI_MAINWINDOW,MUIA_Window_Open,TRUE);
  659.   guiset(out,INT,WI_MESSAGES,MUIA_Window_Open,TRUE);
  660.   guiRequest(9);
  661.  
  662.   return(0);
  663. }
  664.  
  665.